<template>
  <div>
    <div class="content">
      <div>
        <div class="newshead">
          <div class="title-head" title="成功案例">成功案例</div>
        </div>
      </div>
      <div class="newsarea">
        <div class="location">
          <div class="selectname">
            {{selectName}}
          </div>
          <div class="local">
            <span>当前位置：</span>
            <span><a href="/">首页</a></span>
            <el-divider direction="vertical"></el-divider>
            <span><a href="#">成功案例</a></span>
          </div>
        </div>
        <div class="area-content" v-for="(item,index) in newsList" :key="index" @click="casedeatil(item)">
          <div>
            <div style="padding:10px 0 0 10px;">
              <span class="casetitle">{{item.title}}</span>
              <span class="casetime">{{item.updateTime}}</span>
            </div>
            <div class="box">
              <el-image class="img" fit="cover" :src="item.successtList[0].url">
              </el-image>
              <div class="casedesc">
                {{item.introduction}}
              </div>
            </div>
          </div>
        </div>
        <div class="pageBox">
          <el-pagination background layout="prev, pager, next" :page-size="5" :total=total @current-change="getpage">
          </el-pagination>
        </div>
      </div>
    </div>

  </div>
</template>

<script>
export default {
  name: 'CaseTitle',
  data () {
    return {
      selectName: '成功案例',
      pages: 1,
      newsList: [],
      total: 0
    }
  },
  methods: {
    getpage (e) {
      this.$axios({
        method: 'get',
        url: '/success/select?page=' + e + '&pageSize=5'
      }).then((res) => {
        if (res.status === 200) {
          this.newsList = res.data.data.rows
          this.total = res.data.data.records
        }
      })
    },
    casedeatil (item) {
      this.$router.push({
        path: '/Deatil',
        query: {
          name: 'Case',
          id: item.id
        }
      })
    },
    getData () {
      this.$axios({
        method: 'get',
        url: '/success/select?page=1&pageSize=5'
      }).then((res) => {
        if (res.status === 200) {
          this.newsList = res.data.data.rows
          this.total = res.data.data.records
        }
      })
    }
  },
  mounted () {
    this.getData()
  }
}
</script>

<style scoped>
.content {
  padding: 20px 100px;
  display: flex;
  margin-top: 60px;
  overflow: hidden;
}
.newshead {
  width: 300px;
  height: 60px;
  background: rgb(15, 66, 155);
  color: white;
  font-size: 25px;
  text-align: center;
  margin-bottom: 40px;
  overflow: hidden;
}
.newsarea {
  padding-left: 40px;
  width: 100%;
}
.location {
  height: 60px;
  display: flex;
  justify-content: space-between;
}
.area-content {
  margin-top: 30px;
  overflow: hidden;
  min-height: 200px;
  background: white;
  border-radius: 5px;
}
.selectname {
  color: #0f4a9b;
  font-size: 25px;
  height: 22px;
  margin: 20px 0;
}
.local {
  font-size: 18px;
  height: 22px;
  margin: 20px 0;
}
.title-head {
  line-height: 40px;
  margin: 10px 0;
  cursor: pointer;
}
a {
  text-decoration: none;
  color: black;
}
.item {
  font-size: 18px;
  height: 35px;
  margin: 5px 0;
  overflow: hidden;
}
.pageBox {
  position: relative;
}
.el-pagination {
  position: relative;
  left: 25%;
}
.casetitle {
  font-size: 20px;
  font-weight: 800;
}
.casetime {
  float: right;
  color: #cccccc;
  margin-right: 20px;
}
.img {
  width: 150px;
  height: 125px;
  float: left;
  margin-left: 10px;
}
.box {
  margin: 30px 0 30px 0;
}
.casedesc {
  height: 125px;
  margin: 0 100px 0 160px;
  padding: 0px 10px;
  line-height: 30px;
  display: flex;
  align-items: center;
}
</style>
